﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Tradex.Trading;

namespace Tradex.Messages {
    
    /// <summary>
    /// This message contains a list of accounts that are available from a specific connection. It is originated by
    /// a connector to inform the system of the accounts it knows about. It is also forwarded from the MarketService
    /// to initialize collections of known accounts.
    /// </summary>
    [Serializable()]
    public sealed class AccountsUpdateMessage : Message {

        /// <summary>
        /// Public Constructor taking all arguments.
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="accounts"></param>
        public AccountsUpdateMessage(ConnectionKey connection, AccountKey [] accounts) {
            Connection = connection;
            Accounts = accounts;
        }

        /// <inheritdoc />
        public override MessageCode Code { get { return MessageCode.InstrumentUpdate; } }

        /// <summary>
        /// Gets the ConnectionKey used to identify the connection.
        /// </summary>
        public ConnectionKey Connection { get; private set; }

        /// <summary>
        /// Gets a list of AccountKeys that correspond to the accounts the connection knows about.
        /// </summary>
        public IEnumerable<AccountKey> Accounts { get; private set; }
    }

}
